<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        width: 200px;
        height: 200px;
        margin: 400px auto;
        border-radius: 50%;
        background-color: #f00;
        transform-origin: center -800px;
        /* transform: rotate(45deg); */
        animation: rotate 2s .5s ease-in-out 2 both;
      }
      @keyframes rotate {
        0%,
        100% {
          transform: rotate(30deg);
        }
        50% {
          transform: rotate(-30deg);
        }
      }
    </style>
  </head>
  <body>
    <div class="box" style="transform: rotate(45deg)"></div>
  </body>
</html>

